home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 41
/
Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso
/
-seriously_amiga-
/
programming
/
other
/
gui4cli
/
g4c
/
dialer.gc
< prev
next >
Wrap
Text File
|
1999-04-29
|
3KB
|
159 lines
G4C
; a gui for keeping phone numbers etc..
; It needs the program DialNumber.lha - on Aminet - to actually
; dial the number - or it could be ajdusted for any other similar
; program, very easily.
WINBIG 270 24 307 179 Dialer.gc
WinType 11110001
BOX 0 0 0 0 out button
xOnLoad
extract dialer.gc guipath path
joinfile $path Dialer.dat datafile
GuiOpen Dialer.gc
lvuse dialer.gc 1
lvchange $datafile
editflag = 0
xOnClose
if $editflag = 1
ezreq 'Datafile was changed.\nDo you want to save it ?' 'Save|Discard|CANCEL' choice
if $choice = 0
; cancelled
guiopen dialer.gc
stop
elseif $choice = 1
; save
lvuse dialer.gc 1
lvsave $datafile
endif
endif
GuiQuit Dialer.gc
guiquit dialer.g
; ==============================================================
; Listview
; ==============================================================
XLISTVIEW 5 4 208 172 "" item "" 0 SHOW
gadid 1
; ==============================================================
; Listview handling
; ==============================================================
BOX 218 4 83 65 in button
XBUTTON 222 7 75 14 "Add"
guiopen dialer.g ''
XBUTTON 222 22 75 14 "Edit"
lvuse dialer.gc 1
if $$lv.line > ''
rec = $$lv.rec
guiopen dialer.g $dialer.gc/rec
endif
XBUTTON 222 37 75 14 "Delete"
lvuse dialer.gc 1
lvdel -1
XBUTTON 222 52 75 14 "Save"
lvuse dialer.gc 1
lvsave $datafile
editflag = 0
; ==============================================================
; Dialing & options
; ==============================================================
BOX 218 72 83 26 in button
XRADIO 276 75 18 9 tone 2
RSTR Tone 1
RSTR Pulse 2
BOX 217 100 83 26 in button
XRADIO 276 103 18 9 modem 2
RSTR Modem ""
RSTR Audio AUDIO
XBUTTON 218 158 83 18 "DIAL"
lvuse dialer.gc 1
if $$lv.line > ''
rec = $$lv.rec
cutvar rec copy word -1 phone
SetWinTitle dialer.gc 'Dialing $phone ...'
cli 'dialnumber >nil: $phone $modem'
SetWinTitle dialer.gc 'Connect $phone'
endif
; &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
; ==============================================================
NEWFILE dialer.g ; for add/edit items
; ==============================================================
; &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
WINBIG 164 114 324 49 Dialer.g
WinType 11110001
BOX 0 0 324 49 out button
xOnOpen rec
if $rec > ''
cutvar rec cut word -1 phone
extract phone clean phone
cutvar rec cut word -1 '' ; also cut the "-"
name = $rec
else
name = ''
phone = ''
endif
update dialer.g 1 $name
update dialer.g 2 $phone
setgad dialer.g 1 on
CTEXT 11 4 "Enter full name and particulars:" #screen 8 2 0 "0001"
XTEXTIN 10 16 306 13 "" name "" 100
gadid 1
gadhelp 'Enter Name etc and press ENTER'
if $name < ' '
; nothing entered - close
guiclose dialer.g
lvuse dialer.gc 1
lvsort asc
else
setgad dialer.g 2 on
endif
CTEXT 16 32 "Telephone number:" #screen 8 2 0 "0001"
XTEXTIN 140 31 176 13 "" phone "" 30
gadid 2
gadhelp 'Enter Phone number and press ENTER to store.'
lvuse dialer.gc 1
if $rec > ''
; we were editing a record
lvput '$name - $phone'
; clear line for next time and close
rec = ''
guiclose dialer.g
lvsort asc
else
; adding a new record
lvadd '$name - $phone'
; continue to add more records
name = ''
phone = ''
update dialer.g 1 ''
update dialer.g 2 ''
setgad dialer.g 1 on
endif
dialer.gc/editflag = 1